<?php
class Point_model extends CI_Model {

	/**
	 * @author Pwint Phyu Shwe
	 * Point Model for tbl_point
	 * CRUD of member's point
	 * This point system can be use to add, deduct the membe's point.
	 * Refer detail in each function's comment section below.
	 */
	// table name
	private $tbl_memberpoint = 'userpoint';

	function __construct()
	{
		// Call the Model constructor
		parent::__construct();
	}
	// get number of users in database
	function count_all(){
		return $this->db->count_all($this->tbl_memberpoint);
	}
	
	// get person by userID
	function get_by_id($userID){
		$this->db->where('userID', $userID);
		return $this->db->get($this->tbl_memberpoint);
	}
	// add new person
	function save($user){
		$this->db->insert($this->tbl_user, $user);
		return $this->db->insert_id();
	}
	// update person by userID
	function update($userID, $person){
		$this->db->where('userID', $userID);
		$this->db->update($this->$tbl_user, $user);
	}
	// delete person by userID
	function delete($userID){
		$this->db->where('userID', $userID);
		$this->db->delete($this->$tbl_user);
	}
}
?>